/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Negocio;

/**
 *
 * @author sistemas
 */
public class VectorEntero {
    private int n;

    public int getN() {
        return n;
    }

    public void setN(int n) {
        this.n = n;
    }
    static final int Max=1000;
    private Negocio.Entero[] V=new Entero[Max];
    public boolean Lleno(){
        return n==Max;
    }
    public boolean Insertar(Negocio.Entero ele){
        if(!this.Lleno()){
            V[n]=ele;
            n++;
            return true;
        }
        else{
            return false;
        }
    }
    public boolean Insertar(int  ele){
        if(!this.Lleno()){
            Entero obj1=new Entero();
            obj1.setNum(ele);
            V[n]=obj1;
            n++;
            return true;
        }
        else{
            return false;
        }
    }
    public Entero LeerVetor(int posicion){
        return V[posicion];
    }
    public void Intercambiar(Entero a, Entero b){
        Entero axu=new Entero();
        axu.setNum(a.getNum());
        a.setNum(b.getNum());
        b.setNum(axu.getNum());
    }
    public void Ordenar(){
        for(int i=0;i<=n-2;i++){
            for(int j=i;j<=n-1;j++){
                if(V[j].getNum()<V[i].getNum()){
                    this.Intercambiar(V[i],V[j]);
                }
            }
        }
    }
    public Boolean Buscar(int ele){
        for(int i=0;i<=n-1;i++)
        {
            if(V[i].getNum()==ele){
                return true;
            }
        }
        return false;
    }
}